<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/admin.css" />
<link rel="stylesheet" type="text/css" href="style/global.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script src="js/artDialog/jquery.artDialog.js?skin=chrome"></script>
<script src="js/artDialog/plugins/iframeTools.source.js"></script>
<script src="js/comm.js" type="text/javascript"></script>
<script src="js/jquery.tabs.js" type="text/javascript"></script>
<script src="js/ocx.js" type="text/javascript"></script>
<title>无标题文档</title>
<script>
$(function () {
	$.tabs({
		selector:"#tb1",
		event:'click',
		selectedClass:'cur',
		callback: function(panels, tabs, index) {
			if (4 == index) {
				JYCsm.showBuyTip();
			}
		}
	});

	var curHisTab = '';
	
	$.tabs({
		selector:"#tb_history",
		event:'click',
		selectedClass:'cur',
		callback: function(panels, tabs, index) {
			switch (index) {
			case 1: // 调查记录
				$("dl #survey_his").load("?c=quesnr&a=quesnrhistory&pid=<?php echo $pid?>");
				break;
			case 2: // 咨询记录
				$("dl #ask_his").load("index.php?c=feed&a=askhistory&pid=<?php echo $pid?>");
				break;
			case 3:
				$("dl #feed_his").load("index.php?c=feed&a=feedhistory&pid=<?php echo $pid?>");
				break;
			case 4:
				$("dl #visit_his").load("index.php?c=visit&a=history&pid=<?php echo $pid?>");
				}
			curHisTab = $(panels).attr('id');
			}
	});
	$("dl #zy_his").load("index.php?c=zy&a=history&pid=<?php echo $pid?>");
	$('#tb_history .pager-his a').live('click', function () {
		$('dl #'+curHisTab).load(this.href);
		return false;
	});
});

</script>
</head>

<body>

<script>
var JYPatient = new NYPatient();
JYPatient.id = '<?php echo $pid?>';
JYPatient.name = '<?php echo $patient['TRUE_NAME']?>';
JYPatient.phone = '<?php echo $patient['PHONE']?>';
var JYTele = window.top.JYTopTele;
JYTele.onHangUp = function () {
	$('.call a').text('呼叫');
	 $('#save-result').click();
};
JYTele.onCallOut = function () {
	$('.call a').html('<font color="red">挂断</font>');
	var questnr = '<?php echo $_SESSION['visit']['questnr']?>';
	if (questnr) {
		$('#open-survey-form').click();
	}
};

$(window).unload(function () {
	JYTele.onHangUp = null;
	JYTele.onCallOut = null;
});

$(function () {	
	$('.call a').click(function () {
		var teleNo = $('#teleNo').val();
		var ydTele = $('#ydTele').attr('checked');
		if (ydTele) {
			teleNo = '0'+teleNo;
		}
		if (!JYTele.isCalling) {
			// 获取控件中的电话号码
			JYTele.callOut(teleNo);
		} else {
			JYTele.hangUp();
			$('.call a').text('呼叫');
		}
	});
	$('.msg a').click(function () {
		JYCsm.showBuyTip();
	});
	$('#teleNo').change(function () {
		if (this.selectedIndex == 1) {
			$('#visit-result-form #targetuser').val('test');
        	$('#visit-result-form #phone').val('test');
		} else {
			$('#visit-result-form #targetuser').val(JYPatient.name);
        	$('#visit-result-form #phone').val(JYPatient.phone);
		}
	});
});
</script>

	<div id="wrap">
    	<div class="m_head">
        	<div class="m_positin">来电处理</div>
        </div>
        <div class="p_content">
        	<div class="p_datas"><div class="p_data">
            	<div class="p_top">
                	<div class="left">
                    	<h2>姓名：<span class="red"><?php echo $patient['TRUE_NAME']?></span>性别：<span class="red"><?php echo $patient['SEX']?></span>年龄：<span class="red"><?php echo ATools::getAge($patient['BIRTH'])?></span></h2>
                        <table class="tabClient" border="0" width="100%">
                          <tr><th height="25">身份证号：</th><td ><?php echo $patient['CARD']?></td><th>出生日期：</th><td><?php echo $patient['BIRTH']?></td></tr>
                          <tr><th height="25">职<span class="spacing_one"></span>业：</th><td><?php echo $patient['JOB']?></td><th>籍<span class="spacing_one"></span>贯：</th><td><?php echo $patient['BIRTH_PLACE']?></td></tr>
                          <tr><th height="25">住<span class="spacing_one"></span>址：</th><td colspan="3"><?php echo $patient['ADDR']?></td></tr>
                          <tr><th height="25">联<span class="spacing_two"></span>系<span class="spacing_two"></span>人：</th><td colspan="3"><?php echo $patient['LXR_NAME']?> / <?php echo $patient['RELATION']?></td></tr>
                        </table>
                        <div class="p_message">
                          <img src="images/bg_callrun_message.jpg" height="36" width="375" />
                          <div class="pm_content">
                          	<span style="color:#fff; padding-left:10px;">来电手机号码：
                             <?php if ($patient['PHONE']) {
									echo $patient['PHONE'];
                                }elseif($patient['LXR_PHONE'] and $patient['LXR_PHONE'] != $patient['PHONE']) {
									 echo $patient['LXR_PHONE'].'(联)';
                                }?>
                              </span>
                              <div class="msg" style="padding-left: 19px;width: 60px;"><a href="javascript:void(0);">发送短信</a></div>
                              <div class="clear"></div>
                           </div>
                    	</div>
                    </div>
                    <div class="right">
                    	<h2>客户最新住院情况</h2>
                        <dl class="tabs" id="tb1">
                            <dt>
                                <a class="cur">基本情况</a>
                                <a>出院医嘱</a>
                                <a>出院诊断</a>
                                <a>手术信息</a>
                                <a>健康处方</a>
                            </dt>
                            <div class="clear"></div>
                            <dd>
                                <table class="tabCase" width="0" border="0">
                                  <tr><td height="26" width="35%"><b>住院号：</b><?php echo $zhuyuan['ZY_NO']?></td><td width="35%"><b>住院次数：</b><?php echo $zhuyuan['ZY_TIMES']?></td></tr>
                                  <tr><td height="26"><b>入院时间：</b><?php echo date('Y-m-d',strtotime($zhuyuan['RY_DATE']))?></td><td><b>出院时间：</b><?php echo date('Y-m-d', strtotime($zhuyuan['CY_DATE']))?></td></tr>
                                  <tr><td height="26"><b>住院天数：</b><?php echo $zhuyuan['ZY_DAYS']?></td><td><b>已出院：</b><span class="red"><?php echo ATools::getAge($zhuyuan['CY_DATE'], '年')?></span></td></tr>
                                  <tr><td height="26"><b>科室：</b><?php echo $zhuyuan['CY_DEP']?></td><td><b>复诊日期：</b>无需复诊</td></tr>
                                  <tr><td height="26"><b>管床医生：</b><?php echo $zhuyuan['ZYDOC']?></td><td><b>责任护士：</b><?php echo $zhuyuan['ZKNURSE']?></td></tr>
                                </table>
                            </dd>
                            <dd><?php echo $zhuyuan['CY_YZ']?></dd>
                            <dd><?php echo $zhuyuan['RY_ZD']?></dd>
                            <dd>
                            	<?php if ($operation) {?>
                            	<table class="qi_table" width="0" border="0" cellpadding="0" cellspacing="1">
                                  <tr><th >手术名称</th><th>手术时间</th><th>愈合</th><th>医生</th></tr>
                                  <?php foreach ($operation as $oper) {?>
                                  <tr><td width="30%"><?php echo $oper['OP_NAME']?></td><td><?php echo $oper['OP_DATE']?></td><td><?php echo $oper['YUHE']?></td><td><?php echo $oper['DOC_NAME']?></td></tr>
                                  <?php }?>
                                 </table>
                                <?php } else {?>
                                	没有手术记录
                                <?php }?>
                            </dd>
                            <dd id="zy_jkcf"></dd>
                        </dl>
                    </div>
                    <div class="clear"></div>
                </div>
                <div class="p_bottom">
                    <img src="images/bg_p_data_bottom_left.jpg" width="380" height="49" border="0" usemap="#Map2" class="left" />
                    <map name="Map2" id="Map2">
                       <area shape="rect" coords="1,1,76,48" href="javascript: JYCsm.showBuyTip();" />
                       <area shape="rect" coords="76,1,153,49" href="javascript: JYCsm.openFeedForm('<?php echo $zhuyuan['CY_DEP_NO']?>', '<?php echo $zhuyuan['ZYDOC_NO']?>');" />
                       <area shape="rect" coords="152,-1,227,48" id="open-survey-form" href="javascript: JYCsm.openSurveyForm('<?php echo $_SESSION['visit']['questnr']?>', JYPatient.id, JYPatient.name, JYPatient.phone);" />
                       <area shape="rect" coords="228,0,303,49" href="javascript: JYCsm.openAskForm('<?php echo $zhuyuan['CY_DEP_NO']?>', '<?php echo $zhuyuan['ZYDOC_NO']?>');" />
                       <area shape="rect" coords="304,2,381,49" href="javascript: JYCsm.openPatientForm();" />
                    </map>
					<div class="right">
                    	<input id="save-result" class="btn_pOne" name="" type="button" value="" /> 
                    </div>
                    <div class="clear"></div>
                </div>
            </div></div>
            <dl class="p_r_tabs" id="tb_history">
                <dt>
                    <a class="cur">住院信息</a>
                    <a>问卷调查</a>
                    <a>咨询记录</a>
                    <a>反馈跟踪</a>
                    <a>回访记录</a>
                </dt>
                <div class="clear"></div>
                <dd id="zy_his"></dd>
                <dd id="survey_his"></dd>
                <dd id="ask_his"></dd>
                <dd id="feed_his"></dd>
                <dd id="visit_his"></dd>
            </dl>
        </div>
    </div>



<div id="visit-result-dlg" style="display: none;">
<div class="msgBox">
<script type="text/javascript">
$(function() { 
    $('#save-btn').click(function() {
        JYCsm.form.ajaxPost({formSelector:'#visit-result-form', dlgId:'save-result-dlg',
            callback: function (rsp, status, xhr) {
                if (rsp.code > 0) {
                    //设置本地cookie
                    
                }
            }
            });
        return false;
    });
    
    $('#close-btn').click(function(e) {
        JYCsm.closeWindow('save-result-dlg');
        return false;
    });

    // 在回访状态成功时 可设置回访结果
	$('#status').change(function () {
		var val = $('#status').val();
		if (val == 'B') {// 回访成功
			$('#result').attr('disabled', false);
		} else {
			$('#result').attr('disabled', true);
		}
	});
}); 
</script>
    	<h2>回访小结保存</h2>
        <div class="bc">
        	<form method="post" action="?c=visit&a=result" id="visit-result-form" name="visit-result-form">
        	<input type="hidden" name="pid" value="<?php echo $patient['PATIENT_ID']?>" />
        	<input type="hidden" name="pname" value="<?php echo $patient['TRUE_NAME']?>" />
        	<input type="hidden" name="bizcode" value="<?php echo $zhuyuan['BIZ_CODE']?>" />
        	<input type="hidden" name="sysid" value="1" />
        	<input type="hidden" name="rule" value="1" />
        	<input type="hidden" name="type" value="1" />
        	<input type="hidden" name="doc" value="<?php echo $zhuyuan['ZYDOC_NO']?>" />
        	<input type="hidden" name="dep" value="<?php echo $zhuyuan['CY_DEP_NO']?>" />
        	<input type="hidden" name="targetuser" id="targetuser" value="<?php echo $patient['TRUE_NAME']?>" />
        	<input type="hidden" name="phone" id="phone" value="<?php echo $patient['PHONE']?>" />
        	<table class="tableForm" width="100%" border="0">
              <tr><th height="35" width="100">回访结果：</th><td>
              	<select id="status" class="select" name="status">
              	<?php 
              	$visitStatus = ATools::getConfig('app.visitStatus');
              	$unvisit = array_slice($visitStatus, 0, 1);
              	array_shift($visitStatus);
              	$visitStatus = array_merge($visitStatus, $unvisit);
              	foreach ($visitStatus as $value=>$name) {
              		echo '<option value="'.$value.'">'.$name.'</option>';
              	}
              	?>
              	</select></td></tr>
               <tr id="result-row"><th height="35" width="100">回访评价：</th><td>
               <select id="result" class="select" name="result">
               <?php 
               $visitResult = ATools::getConfig('app.visitResult');
               foreach ($visitResult as $value=>$name) {
               		echo '<option value="'.$value.'">'.$name.'</option>';
               }
               ?>
               </select></td></tr>
              <tr><th style="vertical-align:top;">内容：</th><td><textarea class="textarea" name="content" cols="2" rows="10"></textarea></td></tr>
              <tr><th height="35">&nbsp;</th><td><input name="track" type="checkbox" value="1" />需要继续跟进</td></tr>
              <tr><th height="35">&nbsp;</th><td><input id="save-btn" class="btn_save" name="" type="button" value="" style="float:left;"/><input style="float:left; margin-left: 10px;" id="close-btn" class="btn_gray" name="" type="button" value="取 消"/></td></tr>
            </table>
            </form>
        </div>
</div>
</div>

<!-- 回访结果保存对话框 -->
<script type="text/javascript">
$(function () {
	// 回访保存
	$('#save-result').click(function () {
		window.top.art.dialog({
			id: 'save-result-dlg',
			title: '回访小结保存', 
			width: 500,
			padding: 10,
			content: $('#visit-result-dlg').html()});
	});

	// 回访下一个
	$('#next-entry').click(function () {
		window.location.href="?c=visitzy&a=entry&p=<?php echo $next?>";
	});
});
</script>
    
</body>
</html>